package com.snake.springboot.custom.service.assemble.base;


import com.snake.springboot.custom.api.model.base.CustRoleModel;
import com.snake.springboot.custom.api.request.base.CustRoleQuery;
import com.snake.springboot.custom.dao.mybatis.entity.base.CustRoleDO;
import org.snake.common.code.SerialNumberGeneratorFactory;
import org.snake.common.utils.PropertyUtils;

/**
 * <p>角色组装器
 * 类{@code CustRoleAssemble} </br>
 * 创建时间2025/2/10 17:02
 *
 * @author yangxt
 * @see
 */
public class CustRoleAssemble {

    public static CustRoleDO roleDOAss(CustRoleModel model, boolean isAdd) {
        if (isAdd){
            model.setCustRoleId(SerialNumberGeneratorFactory.buildId4Bean());
        }
        CustRoleDO roleDO = new CustRoleDO();
        PropertyUtils.copyProperties(roleDO,model);
        return roleDO;
    }

    public static CustRoleDO roleDOAss(CustRoleQuery query) {
        CustRoleDO roleDO = new CustRoleDO();
        PropertyUtils.copyProperties(roleDO,query);
        return roleDO;
    }
}
